package org.sao.security.core.social.qq.config;

import org.sao.security.core.properties.QQProperties;
import org.sao.security.core.properties.SecurityProperties;
import org.sao.security.core.social.qq.connect.QQConnectionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.autoconfigure.social.SocialAutoConfigurerAdapter;
import org.springframework.context.annotation.Configuration;
import org.springframework.social.connect.ConnectionFactory;


@Configuration
@ConditionalOnProperty(prefix="zy.security.social.qq",name="appId")
public class QQAutoConfig extends SocialAutoConfigurerAdapter {

	@Autowired
	private SecurityProperties securityProperties; 
	
	@Override
	protected ConnectionFactory<?> createConnectionFactory() {
		// TODO Auto-generated method stub
		QQProperties qp =securityProperties.getSocial().getQq();
		return new QQConnectionFactory(qp.getProviderId(), qp.getAppId(), qp.getAppSecret());
	}
	
	

}
